package com.zzedu.enmuns;

import java.util.Arrays;

/**
 * 响应类枚举
 *
 * @author Administrator
 */
public enum ResponseCodeEnums {

    SUCCESS(1, "成功"),
    FAIL(2, "失败"),
    PROCESSING(3, "处理中"),
    ;

    ResponseCodeEnums(int code, String desc) {
        this.code = code;
        this.desc = desc;
    }

    private int code;

    private String desc;

    public int getCode() {
        return code;
    }

    public void setCode(int code) {
        this.code = code;
    }

    public String getDesc() {
        return desc;
    }

    public void setDesc(String desc) {
        this.desc = desc;
    }

    public static ResponseCodeEnums getCode(int code) {
        return Arrays.stream(ResponseCodeEnums.values()).filter(e -> e.getCode() == code).findFirst().orElse(null);
    }

}
